/**
 * [deepClone 深拷贝]
 * @param  {[Object]} obj [要拷贝的对象]
 * @return {[Object]}     [拷贝出的新的对象]
 */
export function deepClone(obj) {
    let copy;

    switch (typeof obj) {
        case 'number':
        case 'string':
        case 'boolean':
            copy = obj;
            break;
        case 'object':
            if (obj === null) {
                copy = null;
            } else if (toString.apply(obj) === '[object Array]') {
                copy = [];
                for (const i in obj) {
                    copy = copy.concat(deepClone(obj[i]));
                }
            } else {
                copy = {};
                for (const j in obj) {
                    copy[j] = deepClone(obj[j]);
                }
            }
        default:
            break;
    }

    return copy;
}